From 34d547a2aa0d9031108489b8358e806605038011 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 17 Nov 2020 13:33:59 -0500 Subject: [PATCH] inspector: Limit the width of readonly properties For readonly properties, we show the serialized value in a label. If we don't take precautions, this can cause our window to grow extremely wide, and break things. So, ellipsize things at a reasonable size. Fixes: #3278 --- gtk/inspector/prop-editor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c index dc2f6f2648..019d34ffbe 100644 --- a/gtk/inspector/prop-editor.c +++ b/gtk/inspector/prop-editor.c @@ -1551,6 +1551,11 @@ constructed (GObject *object) if (!can_modify) { label = gtk_label_new (""); + gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END); + gtk_label_set_max_width_chars (GTK_LABEL (label), 20); + gtk_label_set_xalign (GTK_LABEL (label), 0.0); + gtk_widget_set_hexpand (label, TRUE); + gtk_widget_set_halign (label, GTK_ALIGN_FILL); gtk_widget_add_css_class (label, "dim-label"); gtk_box_append (GTK_BOX (box), label); -- 2.30.2